package com.yazi.mxz.behavior.entity.beans;

import com.myframework.smhj.hibernate.Entity;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.SEQUENCE;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 * Category entity. @author MyEclipse Persistence Tools
 */
@javax.persistence.Entity
@Table(name = "MXZ_CATEGORY", schema = "HCD_DEV")
public class Category extends Entity implements java.io.Serializable {

	// Fields

	private Long catId;
	private Category category;
	private Integer type;
	private String name;
	private Integer deep;
	private String pic;
	private Long sort;
	private Long updateTime;
	private Set<Category> categories = new HashSet<Category>(0);

	// Constructors

	/** default constructor */
	public Category() {
	}

	/** minimal constructor */
	public Category(Integer type, String name, Integer deep, Long sort, Long updateTime) {
		this.type = type;
		this.name = name;
		this.deep = deep;
		this.sort = sort;
		this.updateTime = updateTime;
	}

	/** full constructor */
	public Category(Category category, Integer type, String name, Integer deep, String pic,
			Long sort, Long updateTime, Set<Category> categories) {
		this.category = category;
		this.type = type;
		this.name = name;
		this.deep = deep;
		this.pic = pic;
		this.sort = sort;
		this.updateTime = updateTime;
		this.categories = categories;
	}

	// Property accessors
	@SequenceGenerator(name = "generator", sequenceName = "SEQ_CATEGORY")
	@Id
	@GeneratedValue(strategy = SEQUENCE, generator = "generator")
	@Column(name = "CAT_ID", unique = true, nullable = false, precision = 15, scale = 0)
	public Long getCatId() {
		return this.catId;
	}

	public void setCatId(Long catId) {
		this.catId = catId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "PARENT_ID")
	public Category getCategory() {
		return this.category;
	}

	public void setCategory(Category category) {
		this.category = category;
	}

	@Column(name = "TYPE", nullable = false, precision = 2, scale = 0)
	public Integer getType() {
		return this.type;
	}

	public void setType(Integer type) {
		this.type = type;
	}

	@Column(name = "NAME", nullable = false, length = 100)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "DEEP", nullable = false, precision = 2, scale = 0)
	public Integer getDeep() {
		return this.deep;
	}

	public void setDeep(Integer deep) {
		this.deep = deep;
	}

	@Column(name = "PIC", length = 200)
	public String getPic() {
		return this.pic;
	}

	public void setPic(String pic) {
		this.pic = pic;
	}

	@Column(name = "SORT", nullable = false, precision = 15, scale = 0)
	public Long getSort() {
		return this.sort;
	}

	public void setSort(Long sort) {
		this.sort = sort;
	}

	@Column(name = "UPDATE_TIME", nullable = false, precision = 15, scale = 0)
	public Long getUpdateTime() {
		return this.updateTime;
	}

	public void setUpdateTime(Long updateTime) {
		this.updateTime = updateTime;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "category")
	public Set<Category> getCategories() {
		return this.categories;
	}

	public void setCategories(Set<Category> categories) {
		this.categories = categories;
	}

}